﻿using System;
using System.Collections.Generic;
using System.Text;
using Components;
using DevExpress.XtraEditors.Controls;
using System.Resources;
using System.Collections;
using System.Windows.Forms;
using DevExpress.XtraPivotGrid.Localization;

namespace UI.Lib
{
    public class LocalizerCN : PivotGridLocalizer
    {
        static Dictionary<string, string> Dict = new Dictionary<string, string>();

        public static string Lang =
            "{\"PivotGridStringId.PrintDesignerCategoryHeaders\":\"标题\",\"PivotGridStringId.CustomizationFormAddTo\":\"增加到\",\"PivotGridStringId.PrintDesignerCategoryDefault\":\"默认值\",\"PivotGridStringId.TotalFormatStdDevp\":\"{0}总体标准差\",\"PivotGridStringId.PrintDesignerVerticalLines\":\"垂直格线\",\"PivotGridStringId.PrintDesignerColumnHeaders\":\"列标题\",\"PivotGridStringId.CustomizationFormText\":\"分析备选字段\",\"PivotGridStringId.PrintDesignerUsePrintAppearance\":\"使用打印外观\",\"PivotGridStringId.PrintDesignerDataHeaders\":\"数据标题\",\"PivotGridStringId.PopupMenuHideField\":\"隐藏\",\"PivotGridStringId.TotalFormatCustom\":\"{0}统计值\",\"PivotGridStringId.PopupMenuHideFieldList\":\"隐藏数据栏清单\",\"PivotGridStringId.DataArea\":\"数据区域\",\"PivotGridStringId.RowArea\":\"行区域\",\"PivotGridStringId.PrintDesignerPageBehavior\":\"执行\",\"PivotGridStringId.PopupMenuShowFieldList\":\"显示数据栏清单\",\"PivotGridStringId.TotalFormatSum\":\"{0}小计\",\"PivotGridStringId.PrintDesignerHorizontalLines\":\"水平格线\",\"PivotGridStringId.RowHeadersCustomization\":\"将行域放在这里\",\"PivotGridStringId.PopupMenuExpand\":\"展开\",\"PivotGridStringId.FilterHeadersCustomization\":\"将数据筛选条件域放在这里\",\"PivotGridStringId.DataFieldCaption\":\"数据\",\"PivotGridStringId.ColumnHeadersCustomization\":\"将列域放在这里\",\"PivotGridStringId.FilterArea\":\"数据筛选区域\",\"PivotGridStringId.PopupMenuMovetoBeginning\":\"移到开头\",\"PivotGridStringId.PopupMenuExpandAll\":\"全部展开\",\"PivotGridStringId.PopupMenuRefreshData\":\"刷新数据\",\"PivotGridStringId.TotalFormat\":\"{0}合计\",\"PivotGridStringId.GrandTotal\":\"总计\",\"PivotGridStringId.TotalFormatVarp\":\"{0}总体方差\",\"PivotGridStringId.DataHeadersCustomization\":\"将数据项目放在这里\",\"PivotGridStringId.TotalFormatCount\":\"{0}数据数\",\"PivotGridStringId.CellError\":\"错误\",\"PivotGridStringId.TopValueOthersRow\":\"其他\",\"PivotGridStringId.PopupMenuMovetoEnd\":\"移到最后\",\"PivotGridStringId.PopupMenuFieldOrder\":\"排序\",\"PivotGridStringId.PopupMenuMovetoRight\":\"移到右边\",\"PivotGridStringId.PrintDesignerCategoryLines\":\"格线\",\"PivotGridStringId.PrintDesignerFilterHeaders\":\"数据筛选条件标题\",\"PivotGridStringId.TotalFormatMax\":\"{0} 最大值\",\"PivotGridStringId.PopupMenuMovetoLeft\":\"移到左边\",\"PivotGridStringId.PrintDesignerPageOptions\":\"选项\",\"PivotGridStringId.PrintDesignerRowHeaders\":\"行标题\",\"PivotGridStringId.ColumnArea\":\"列区域\",\"PivotGridStringId.TotalFormatVar\":\"{0}样本方差\",\"PivotGridStringId.TotalFormatStdDev\":\"{0}标准差\",\"PivotGridStringId.Total\":\"合计\",\"PivotGridStringId.TotalFormatAverage\":\"{0}平均\",\"PivotGridStringId.CustomizationFormCaption\":\"标题列表\",\"PivotGridStringId.PopupMenuCollapse\":\"收合\",\"PivotGridStringId.TotalFormatMin\":\"{0} 最小值\",\"PivotGridStringId.PopupMenuCollapseAll\":\"全部收合\",\"PivotGridStringId.FilterShowBlanks\":\"显示空白\",\"PivotGridStringId.FilterShowAll\":\"(全部显示)\"}";

        static LocalizerCN()
        {
            Dict = Json.ToObject<Dictionary<string, string>>(Lang);
        }

        public override string GetLocalizedString(PivotGridStringId id)
        {
            if (Dict.ContainsKey(id.GetType().Name + "." + id.ToString()))
                return Dict[id.GetType().Name + "." + id.ToString()];
            else
                return id.ToString();
        }
    }
}
